package com.sz.mes.dto;

import com.diboot.core.binding.query.BindQuery;
import com.diboot.core.binding.query.Comparison;
import com.sz.mes.entity.SaleOrder;
import com.diboot.iam.entity.IamUser;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.Date;
import com.diboot.core.util.D;

/**
 * 销售订单 DTO定义
 * @author hem
 * @version 1.0
 * @date 2023-09-05
 * Copyright © szhs
 */
@Getter
@Setter
@Accessors(chain = true)
public class SaleOrderDTO extends SaleOrder {

    private static final long serialVersionUID = 3004729431341216016L;

    /**
     * 关联字段 系统用户.真实姓名：IamUser.realname
     */
    @BindQuery(comparison = Comparison.EQ, entity = IamUser.class, field = "realname", condition = "this.create_by=id")
    private String createByName;

    /**
     * 下单日期-起始
     */
    @BindQuery(comparison = Comparison.GE, field = "buyDate")
    private Date buyDate;

    /**
     * 下单日期-截止
     */
    @BindQuery(comparison = Comparison.LT, field = "buyDate")
    private Date buyDateEnd;

    /**
     * 合同要求日期-起始
     */
    @BindQuery(comparison = Comparison.GE, field = "contractDemandDate")
    private Date contractDemandDate;

    /**
     * 合同要求日期-截止
     */
    @BindQuery(comparison = Comparison.LT, field = "contractDemandDate")
    private Date contractDemandDateEnd;

    /**
     * 创建时间-起始
     */
    @BindQuery(comparison = Comparison.GE, field = "createTime")
    private Date createTime;

    /**
     * 创建时间-截止
     */
    @BindQuery(comparison = Comparison.LT, field = "createTime")
    private Date createTimeEnd;

    @Override()
    public Date getBuyDate() {
        return this.buyDate;
    }

    @Override()
    public SaleOrder setBuyDate(Date buyDate) {
        this.buyDate = buyDate;
        return this;
    }

    public Date getBuyDateEnd() {
        return D.nextDay(buyDate);
    }

    public SaleOrder setBuyDateEnd(Date buyDateEnd) {
        this.buyDateEnd = buyDateEnd;
        return this;
    }

    @Override()
    public Date getContractDemandDate() {
        return this.contractDemandDate;
    }

    @Override()
    public SaleOrder setContractDemandDate(Date contractDemandDate) {
        this.contractDemandDate = contractDemandDate;
        return this;
    }

    public Date getContractDemandDateEnd() {
        return D.nextDay(contractDemandDate);
    }

    public SaleOrder setContractDemandDateEnd(Date contractDemandDateEnd) {
        this.contractDemandDateEnd = contractDemandDateEnd;
        return this;
    }

    @Override()
    public Date getCreateTime() {
        return this.createTime;
    }

    @Override()
    public SaleOrder setCreateTime(Date createTime) {
        this.createTime = createTime;
        return this;
    }

    public Date getCreateTimeEnd() {
        return D.nextDay(createTime);
    }

    public SaleOrder setCreateTimeEnd(Date createTimeEnd) {
        this.createTimeEnd = createTimeEnd;
        return this;
    }
}
